package com.shuai.AI.demo.invoke;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.boot.CommandLineRunner;

// @Component
public class SpringAiInvoke implements CommandLineRunner {

  @Resource private ChatModel dashscopeChatModel;

  @Override
  public void run(String... args) throws Exception {
    AssistantMessage output =
        dashscopeChatModel
            .call(new Prompt("你好，我是帅宏-coding,一名26届本科生,同时也是Java全栈开发工程师，你是谁？"))
            .getResult()
            .getOutput();
    System.out.println(output.getText());
  }
}
